package com.seafwg.config;

import com.seafwg.filter.MyFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author seafwg
 * @Date 2022/3/23 11:07 上午
 * @Version 1.0
 * @description xxx
 */

@Configuration
public class FilterConfig {
    /**
     * 注册自定义的filter（servlet 的filter）
     * @return
     */
    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean<MyFilter> regMyFilter = new FilterRegistrationBean<>();
        regMyFilter.setFilter(new MyFilter());
        regMyFilter.addUrlPatterns("/user/*");

        return regMyFilter;
    }
}
